/*
 * @Author: 周鹏飞
 * @Date: 2021-06-08 08:43:30
 * @LastEditors: 周鹏飞
 * @LastEditTime: 2021-07-05 10:37:19
 * @Description: file content
 */

let corePoint=(new BMap.Point(111.989235,32.790482), 11)
var myStyleJson = [{
  "featureType": "land",
  "elementType": "geometry",
  "stylers": {
    "visibility": "on",
    "color": "#06244bff"
  }
}, {
  "featureType": "water",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#051841ff"
  }
}, {
  "featureType": "building",
  "elementType": "geometry.fill",
  "stylers": {
    "visibility": "on",
    "color": "#000c32ff"
  }
}, {
  "featureType": "building",
  "elementType": "geometry.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#000019ff"
  }
}, {
  "featureType": "water",
  "elementType": "geometry",
  "stylers": {
    "visibility": "off",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "village",
  "elementType": "labels",
  "stylers": {
    "visibility": "on"
  }
}, {
  "featureType": "town",
  "elementType": "labels",
  "stylers": {
    "visibility": "on"
  }
}, {
  "featureType": "district",
  "elementType": "labels",
  "stylers": {
    "visibility": "on"
  }
}, {
  "featureType": "country",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "city",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "continent",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "poilabel",
  "elementType": "labels",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "poilabel",
  "elementType": "labels.icon",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "scenicspotslabel",
  "elementType": "labels.icon",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "scenicspotslabel",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "transportationlabel",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "transportationlabel",
  "elementType": "labels.icon",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "airportlabel",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "airportlabel",
  "elementType": "labels.icon",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "road",
  "elementType": "geometry.fill",
  "stylers": {
    "visibility": "on",
    "color": "#0c83c9ff"
  }
}, {
  "featureType": "road",
  "elementType": "geometry.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#0060a1ff"
  }
}, {
  "featureType": "road",
  "elementType": "geometry",
  "stylers": {
    "weight": "3"
  }
}, {
  "featureType": "green",
  "elementType": "geometry",
  "stylers": {
    "visibility": "on",
    "color": "#075e99ff"
  }
}, {
  "featureType": "scenicspots",
  "elementType": "geometry",
  "stylers": {
    "visibility": "on",
    "color": "#051841ff"
  }
}, {
  "featureType": "scenicspots",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "scenicspots",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "continent",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "country",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "city",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "city",
  "elementType": "labels.icon",
  "stylers": {
    "visibility": "on"
  }
}, {
  "featureType": "scenicspotslabel",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "airportlabel",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "transportationlabel",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "railway",
  "elementType": "geometry",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "subway",
  "elementType": "geometry",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "highwaysign",
  "elementType": "labels",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "nationalwaysign",
  "elementType": "labels",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "nationalwaysign",
  "elementType": "labels.icon",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "provincialwaysign",
  "elementType": "labels",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "provincialwaysign",
  "elementType": "labels.icon",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "tertiarywaysign",
  "elementType": "labels",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "tertiarywaysign",
  "elementType": "labels.icon",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "subwaylabel",
  "elementType": "labels",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "subwaylabel",
  "elementType": "labels.icon",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "road",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff",
    "weight": "90"
  }
}, {
  "featureType": "road",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "shopping",
  "elementType": "geometry",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "scenicspots",
  "elementType": "labels",
  "stylers": {
    "visibility": "on"
  }
}, {
  "featureType": "scenicspotslabel",
  "elementType": "labels",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "manmade",
  "elementType": "geometry",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "manmade",
  "elementType": "labels",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "highwaysign",
  "elementType": "labels.icon",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "water",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#075e9900"
  }
}, {
  "featureType": "road",
  "elementType": "labels.text",
  "stylers": {
    "fontsize": "24"
  }
}, {
  "featureType": "highway",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "highway",
  "elementType": "geometry.fill",
  "stylers": {
    "visibility": "on",
    "color": "#0c83c9ff"
  }
}, {
  "featureType": "highway",
  "elementType": "geometry.stroke",
  "stylers": {
    "color": "#1c4f7eff"
  }
}, {
  "featureType": "highway",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "highway",
  "elementType": "geometry",
  "stylers": {
    "weight": 0.5
  }
}, {
  "featureType": "nationalway",
  "elementType": "geometry.fill",
  "stylers": {
    "visibility": "on",
    "color": "#0c83c970"
  }
}, {
  "featureType": "nationalway",
  "elementType": "geometry.stroke",
  "stylers": {
    "color": "#1c4f7eff"
  }
}, {
  "featureType": "nationalway",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "nationalway",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "nationalway",
  "elementType": "geometry",
  "stylers": {
    "weight": 0.1,
    "visibility": "on"
  }
}, {
  "featureType": "provincialway",
  "elementType": "geometry.fill",
  "stylers": {
    "visibility": "on",
    "color": "#0c83c970"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "geometry.fill",
  "stylers": {
    "visibility": "on",
    "color": "#0c83c961"
  }
}, {
  "featureType": "arterial",
  "elementType": "geometry.fill",
  "stylers": {
    "visibility": "on",
    "color": "#0c83c966"
  }
}, {
  "featureType": "tertiaryway",
  "elementType": "geometry.fill",
  "stylers": {
    "visibility": "on",
    "color": "#0c83c954"
  }
}, {
  "featureType": "fourlevelway",
  "elementType": "geometry.fill",
  "stylers": {
    "visibility": "on",
    "color": "#0c83c94d"
  }
}, {
  "featureType": "local",
  "elementType": "geometry.fill",
  "stylers": {
    "visibility": "on",
    "color": "#0c83c947"
  }
}, {
  "featureType": "provincialway",
  "elementType": "geometry.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#0060a1ff"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "geometry.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#0060a1ff"
  }
}, {
  "featureType": "arterial",
  "elementType": "geometry.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#0060a1ff"
  }
}, {
  "featureType": "tertiaryway",
  "elementType": "geometry.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#0060a1ff"
  }
}, {
  "featureType": "fourlevelway",
  "elementType": "geometry.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#0060a1ff"
  }
}, {
  "featureType": "local",
  "elementType": "geometry.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#0060a1ff"
  }
}, {
  "featureType": "local",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "local",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "fourlevelway",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "tertiaryway",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "arterial",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "provincialway",
  "elementType": "labels.text.fill",
  "stylers": {
    "visibility": "on",
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "provincialway",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "arterial",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "tertiaryway",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "fourlevelway",
  "elementType": "labels.text.stroke",
  "stylers": {
    "visibility": "on",
    "color": "#4a90e2ff",
    "weight": "1"
  }
}, {
  "featureType": "fourlevelway",
  "elementType": "geometry",
  "stylers": {
    "weight": 0.5
  }
}, {
  "featureType": "tertiaryway",
  "elementType": "geometry",
  "stylers": {
    "weight": 0.5,
    "visibility": "on"
  }
}, {
  "featureType": "local",
  "elementType": "geometry",
  "stylers": {
    "weight": "1"
  }
}, {
  "featureType": "provincialway",
  "elementType": "geometry",
  "stylers": {
    "weight": 0.1,
    "visibility": "on"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "geometry",
  "stylers": {
    "weight": "3",
    "visibility": "off"
  }
}, {
  "featureType": "arterial",
  "elementType": "geometry",
  "stylers": {
    "weight": 0.1,
    "visibility": "on"
  }
}, {
  "featureType": "cityhighway",
  "stylers": {
    "level": "6",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "stylers": {
    "level": "7",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "stylers": {
    "level": "8",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "stylers": {
    "level": "9",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "geometry",
  "stylers": {
    "visibility": "off",
    "level": "6",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "geometry",
  "stylers": {
    "visibility": "off",
    "level": "7",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "geometry",
  "stylers": {
    "visibility": "off",
    "level": "8",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "geometry",
  "stylers": {
    "visibility": "off",
    "level": "9",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "labels",
  "stylers": {
    "visibility": "off",
    "level": "6",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "labels",
  "stylers": {
    "visibility": "off",
    "level": "7",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "labels",
  "stylers": {
    "visibility": "off",
    "level": "8",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "labels",
  "stylers": {
    "visibility": "off",
    "level": "9",
    "curZoomRegionId": "0",
    "curZoomRegion": "6-9"
  }
}, {
  "featureType": "arterial",
  "stylers": {
    "level": "9",
    "curZoomRegionId": "0",
    "curZoomRegion": "9-9"
  }
}, {
  "featureType": "arterial",
  "elementType": "geometry",
  "stylers": {
    "visibility": "off",
    "level": "9",
    "curZoomRegionId": "0",
    "curZoomRegion": "9-9"
  }
}, {
  "featureType": "arterial",
  "elementType": "labels",
  "stylers": {
    "visibility": "off",
    "level": "9",
    "curZoomRegionId": "0",
    "curZoomRegion": "9-9"
  }
}, {
  "featureType": "district",
  "elementType": "labels.text.fill",
  "stylers": {
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "district",
  "elementType": "labels.text.stroke",
  "stylers": {
    "color": "#ffffff00"
  }
}, {
  "featureType": "town",
  "elementType": "labels.text.stroke",
  "stylers": {
    "color": "#ffffff00"
  }
}, {
  "featureType": "town",
  "elementType": "labels.text.fill",
  "stylers": {
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "village",
  "elementType": "labels.text.stroke",
  "stylers": {
    "color": "#ffffff00"
  }
}, {
  "featureType": "village",
  "elementType": "labels.text.fill",
  "stylers": {
    "color": "#3eb9ebff"
  }
}, {
  "featureType": "scenicspotsway",
  "elementType": "geometry.fill",
  "stylers": {
    "color": "#ffffff6e"
  }
}, {
  "featureType": "universityway",
  "elementType": "geometry.fill",
  "stylers": {
    "color": "#ffffff70"
  }
}, {
  "featureType": "water",
  "elementType": "labels",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "cityhighway",
  "elementType": "labels",
  "stylers": {
    "visibility": "off"
  }
}, {
  "featureType": "provincialway",
  "elementType": "labels",
  "stylers": {
    "visibility": "on"
  }
}, {
  "featureType": "arterial",
  "elementType": "labels",
  "stylers": {
    "visibility": "on"
  }
}]
function initialization_map() {
  vm.map = new BMap.Map("container");
  vm.map.centerAndZoom(new BMap.Point(111.989235,32.790482), 11);

  vm.map.addTileLayer() // 开启地图路况功能
  vm.map.setMapStyle({ styleJson: myStyleJson });

  vm.map.enableScrollWheelZoom(true);
  Initialization_line()
}
// 画地图线
function Initialization_line(){
  $.ajax({
    type: 'post',
    url: httpUrl+ 'event/manager/locationAll/getLanAndLonBySpeed',
    data: JSON.stringify({
      // "roadName": "内邓高速"
    }),
    dataType: 'json',
    contentType: "application/json",
    headers: {
      Authorization: localStorage.getItem('token')
    },
    success: function(data) {
      console.log(data)
      if(data.data.localData.length != 0) {
        for(let [key, val] of Object.entries(data.data.localData)) {
          let arrlist = []
          for(let [keys, vals] of Object.entries(val)) {
            arrlist.push(new BMap.Point(vals.lng, vals.lat))
          }
          var polyline = new BMap.Polyline(arrlist, {
            strokeWeight: 8,
            strokeColor: "#5af29f",
            strokeOpacity: .8
          }); //创建折线
          polyline.init="Line"
          vm.map.addOverlay(polyline); //增加折线
        }
      }
    },
    error: function (err) {
      vm.$message({
        message: '查询失败请稍后再试,或与管理员联系',
        type: 'error'
      });
    }
  })
}
